﻿using PureMVC.Patterns.Facade;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameFacade : Facade
{
    //1.继承PureMVC中的Facade脚本
    //2.为了方便使用Facade 需要自己写一个单例模式的属性
    public static GameFacade Instance
    {
        get
        {
            if (instance == null)
            {
                instance = new GameFacade();
            }
            return instance as GameFacade;
        }
    }
    /// <summary>
    /// 初始化 控制层相关内容
    /// </summary>
    protected override void InitializeController()
    {
        base.InitializeController();
        //这里面要写一些关于  命令和通知绑定 的逻辑
        RegisterCommand(PureNotification.START_UP,()=> 
        {
            return new StartUpCommand();
        });
        RegisterCommand(PureNotification.SHOW_PANEL,()=>
        {
            return new ShowPanelCommand();
        });
        RegisterCommand(PureNotification.HIDE_PANEL,()=> 
        {
            return new HidePanelCommand();
        });
        RegisterCommand(PureNotification.LVE_UP, () =>
        {
             return new LveUpCommand();
        });

    }

    public void StartUp()
    {
        //发送一个通知
        SendNotification(PureNotification.START_UP);
    }
}
